Skip to content

fix(fetch): JSON-stringify NaN and Infinity string data - #3249

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
mainfrom
fix-playwright-43329
Oct 13, 2026
Merged

Pavel Feldman (pavelfeldman) merged 1 commit into
mainfrom
fix-playwright-43329

Conversation

@yury-s

Copy link
Copy Markdown
Member

With Content-Type: application/json, string data is sent as-is when it already parses as JSON, and JSON-stringified otherwise. is_json_parsable() used json.loads(), which accepts the non-standard constants NaN, Infinity and -Infinity, so those strings went out unquoted as invalid JSON. Node's JSON.parse rejects them, so Node sends "NaN". is_json_parsable() now rejects these constants through parse_constant, and they take the json.dumps() path like any other string.

Follows #3223, which did the same for float data. The existing string-body test now also posts "NaN".

Fixes: microsoft/playwright#43329

@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit d566fc5 into main Oct 13, 2026
28 of 29 checks passed
@pavelfeldman
Pavel Feldman (pavelfeldman) deleted the fix-playwright-43329 branch October 13, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Python sends non-standard JSON constants unquoted, unlike Node.js

2 participants